'use strict';

/* Controllers */
function DecisionsuptCtrl($scope, $http) {
	$scope.setSidebarMenu = function($index){
		$scope.sidebarMenu = $index;
	}
	$scope.setSidebarStartHour = function(hourString){
		$scope.sidebarStartHour = hourString;
	}
	$scope.setSidebarEndHour = function(hourString){
		$scope.sidebarEndHour = hourString;
	}

	$scope.isShowDatePicker = function(){
		return ($scope.sidebarMenu == 1);
	}
	//
	$scope.isShowDateRange = function(){
		return ($scope.sidebarMenu == 0);
	}

	$scope.isShowForecastFreq = function(){
		return ($scope.sidebarMenu == 0);
	}
	// ----------init options start --------
	// init sidebarMenu
	$scope.sidebarMenus = [
	{
		name : "最优模式",
		children : ["3小时降水", "6小时降水", "12小时降水", "24小时降水"]
	},{
		name : "重要天气决策",
		children : []
	}];

	//init models and method
	$scope.models = [{name: "EC", fieldName : "EC"},
	{name: "T639", fieldName : "T639"},
	{name: "NCEP", fieldName : "NCEP"},
	{name: "GRAPES", fieldName : "GRAPES"},
	{name: "日本模式", fieldName : "GapanModel"},
	{name: "德国模式", fieldName : "GermanModel"}];
	
	$scope.forecastFreqs = ["3/6小时", "9/12小时", "15/18小时", "21/24小时", "27/30小时", 
	"33/36小时", "39/42小时", "45/48小时"];
	//init Date Picker
	$scope.hourOptions =[];
	for (var i = 0; i < 24; i++){
		$scope.hourOptions.push(i + "h");
	}

	// ----------init options end --------
	
	//init parameters
	$scope.form = {};
	$scope.setMenu(2);
	$scope.sidebarMenu = 0;
	$scope.sidebarSubMenu = [0];
	$scope.sidebarModel = {};
	$scope.models.forEach(function(item){
		$scope.sidebarModel[item.fieldName] = false;
	})
	$scope.forecastFreq = 0;
	$scope.form.sidebarDate = "2016-04-10";
	$scope.form.sidebarHour = $scope.hourOptions[8];

	$scope.form.sidebarStartDate = "2016-04-09";
	$scope.form.sidebarEndDate = "2016-04-11";
	$scope.sidebarStartHour = "08h";
	$scope.sidebarEndHour = "08h";
}

